An object-oriented database is a database built on an object-oriented programming language. Object-oriented programming languages have become increasingly popular since the introduction of the programming language C++ in the mid 1980's. C++ has become a de facto standard programming language of choice in many scientific and engineering disciplines, thereby becoming widely known and used in the field of computer programming languages.
As a result of the inherent capabilities provided by object-oriented programming languages, it is natural and convenient to use them to build database systems. In particular, data "objects" of assorted types may be easily defined and accessed. Such objects provide flexible and efficient mechanisms with which a powerful database environment may be created. As used in the field of object-oriented programming, a data object is a particular item of data of a particular type. For example, a given program variable may contain an object which is data of type integer.
Most programming languages provide for a set of predefined data types, such as integers, reals, characters, arrays, pointers, etc. Object-oriented programming languages, however, enable the user (i.e., the programmer) to define new, additional data types. In C++, a user-defined data type is known as a "class." Specifically, a class is an aggregate of named data elements (known as data members), possibly of different types, and an optional set of operations (known as member functions) designed to manipulate that data. A "class object" is a particular item of data of a particular class.
Moreover, object-oriented programming extends such abstract data types to allow for relationships to be established between types and subtypes. This is achieved through a mechanism referred to as "inheritance," a primary characteristic of object-oriented programming. In particular, rather than re-implementing shared characteristics, a class can inherit selected data members of other classes. In C++, for example, inheritance is implemented through the mechanism of "class derivation." One class, known as the "derived class," may inherit selected data from another class, known as the "base class." In this manner, complex classes can be hierarchically derived from simpler classes.
The use of database systems (including object-oriented database systems) to maintain large and complex collections of information has become widespread. In many applications, it is important to be able to specify certain conditions which relate various items of data contained within the database. In some cases it may be important to know when one or more of these conditions becomes true or becomes false. In other cases it may be "demanded" that all of these conditions are always satisfied (i.e., true). An important example of this latter situation is in the maintenance of database integrity. Specifically, database integrity requires that all of the data contained in the database is logically consistent with itself, with other data in the database, and with any other semantic rules imposed by the database designer. In any case, these conditions are typically boolean (true/false) expressions, and are referred to generally as "constraints."
Databases must serve as an uncorrupted repository of data. Application programs that consult the database expect the database to supply correct data values. As such, the maintenance of integrity of the database is vital. Once a database loses integrity, correcting the problem can be difficult. This is because the location or source of the error is generally not obvious from the condition of the data. For example, a mismatch in data entries that are supposed to match could be due to an error in creating or updating either entry.
Not only is database integrity maintenance important, it can be a very time consuming task. This results from the fact that upon each update to the database (i.e., adding, deleting or modifying an entry), all of the constraints which might possibly be violated as a result of that update must be checked. For this reason it is advantageous to structure the database in such a manner as to ensure that a constraint is evaluated only when the update is made to a type of entry whose modification might have an effect on the evaluation of that constraint. In addition, an efficient representation of each constraint, allowing its evaluation to be performed quickly, is also of great importance.
By virtue of object orientation, some constraints in an object-oriented database are represented naturally and maintained "for free." Such constraints may be directly captured by the "type" system and the object class hierarchy. For example, in C++ a class person and another class child derived from the class person may be defined. In this manner, all of the characteristics (i.e., the information) associated with a person object (e.g., name, age, etc.) will automatically be associated with each child object as well. In other words, constraints are not needed to ensure that each child is, in fact, a person. Other forms of integrity constraints apply to a single object, and can therefore be directly associated with the object class specification used to define the class. For example, if one of the data items included in each person object is age and another is years-of-schooling, the database designer may reasonably wish to require that years-of-schooling be at least 5 less than age.
However, by taking the object-oriented approach, it also becomes unnatural to represent many inter-object constraints. For example, it may be desirable to have a constraint that the age of a person must be at least 12 greater than the age Of any child of that person. This constraint requires that the age attributes of two or more objects, a person and each child of the person, be compared. When an integrity constraint enforces some relationship across object boundaries in this fashion, it is unclear how or where to record such a constraint in an object-oriented database system. For instance, even though the constraint above was stated in terms of the age of a person with respect to that of the children, there is a complementary constraint on the age of a child with respect to that of the parents.